<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>中联物流</title>
    <script src="../js/angular1.4.5.min.js"></script>
    <script src="../js/angular-ui-router.js"></script>
    <script src="../js/jquery-3.2.1.min.js"></script>
    <!-- 引入 echarts.js -->
    <script src="../js/echarts3.0.js"></script>
    <script src="../common/layui/layui.js"></script>
    <link rel="stylesheet" href="../iconfont/myIconfont.css">
    <link rel="stylesheet" href="../common/layui/css/layui.css">
    <link rel="stylesheet" href="../css/index.css">
    <link rel="stylesheet" href="../common/provincialLinkage/area.js">
</head>
<body>
<div ng-app="myAngular" ng-controller="myCtrol" ng-cloak>

    <!--头部-->
    <div id="head">
        <div id="logo"><img src="../image/logo.png" alt=""></div>
        <div id="nav">
            <ul id="nav-ul">
                <li>合同</li>
                <li>产品</li>
                <li>订单</li>
                <li>运输</li>
                <li>采购</li>
                <li>结算</li>
                <li class="nav-ul-other">客户关系</li>
                <li>仓储</li>
            </ul>
            <div id="admin">管理员Admin</div>
        </div>
        <span id="cont-title"></span>
    </div>
    <div id="flex-box">
        <!--<div class="asideView">-->
            <!--<ul>-->
                <!--<li><a ui-sref="/waybillManagement">运单管理</a></li>-->
            <!--</ul>-->
        <!--</div>-->
        <div class="asideView">
            <ul>
                <li ><a ui-sref="wayBillBoard">运单看板</a></li>
                <li><a ui-sref="waybillManagement">运单管理</a></li>
                <li><a ui-sref="transportationTaskManagement">运输任务管理</a></li>
                <li><a ui-sref="qualityQrediction">质量预测</a></li>
                <li><a href="deliverySchedulingDesk">提货调度台</a></li>
            </ul>
        </div>
        <!-- 运单主内容区域-->
        <div id="main-content">

            <!--当前点击使用的状态栏-->
            <div id="page-list">
                <span id="home-page">首页</span>
            </div>

            <!--功能模块-->
            <div ui-view id="page-function"></div>
        </div>
    </div>
</div>
<script>
    var app = angular.module("myAngular", ['ui.router'])
        .config(['$urlRouterProvider', '$stateProvider', function($urlRouterProvider, $stateProvider){
            $stateProvider
                .state('wayBillBoard',{
                    url: '/wayBillBoard',
                    templateUrl:'./template/wayBillBoard.html',
                    controller : 'wayBillBoard'

                })
                .state('waybillManagement',{
                    url: '/waybillManagement',
                    templateUrl : './template/waybillManagement.html'
                })
                .state('provincialLinkage',{
                    url: '/provincialLinkage',
                    templateUrl : './template/provincialLinkage.html',
                    controller : 'provincialLinkage'
                })
                .state('transportationTaskManagement',{
                    url: '/transportationTaskManagement',
                    templateUrl : './template/transportationTaskManagement.html',
                    controller: 'transportationTaskManagement'
                })
                .state('qualityQrediction',{
                    url: '/qualityQrediction',
                    templateUrl : './template/qualityQrediction.html',
                    controller: 'qualityQrediction'
                })
                .state('deliverySchedulingDesk',{
                    url: '/deliverySchedulingDesk',
                    templateUrl : './template/deliverySchedulingDesk.html',
                    controller: 'deliverySchedulingDesk'
                });
            $urlRouterProvider.otherwise('/wayBillBoard');

        }]);
    app.controller("myCtrol", function ($scope,$rootScope) {
        $scope.studentNum = "12345";
            $scope.jisuan = function(){
                alert("asdf");
            };
            $scope.ku = [{name: '江铃库'},{name : '振铃库'},{name:'美丽'},{name:'撒旦'}];
            $rootScope.kek =[{name: '江铃库'},{name : '振铃库'},{name:'美丽'},{name:'撒旦'}];
            $rootScope.gohref = function( arg ){
                  $scope.go(arg);
            };

    }).factory('WaybillBoard',function(){
    });
    app.controller('provc',function($scope){
        $scope.init = function(){
            //初始数据
            $.post('../common/provincialLinkage/area.js',{},function(rsp){
                eval(rsp);
                $scope.areadata = Area;
            });
            var areaData = $scope.areadata;
            var $form;
            var form;
            var $;
            layui.use(['jquery', 'form'], function() {
                $ = layui.jquery;
                form = layui.form();
                $form = $('form');
                loadProvince();
            });
            //加载省数据
            function loadProvince() {
                var proHtml = '';
                for (var i = 0; i < areaData.length; i++) {
                    proHtml += '<option value="' + areaData[i].provinceCode + '_' + areaData[i].mallCityList.length + '_' + i + '">' + areaData[i].provinceName + '</option>';
                }
                //初始化省数据
                $form.find('select[name=province]').append(proHtml);
                form.render();
                form.on('select(province)', function(data) {
                    $form.find('select[name=area]').html('<option value="">请选择县/区</option>').parent().hide();
                    var value = data.value;
                    var d = value.split('_');
                    var code = d[0];
                    var count = d[1];
                    var index = d[2];
                    if (count > 0) {
                        loadCity(areaData[index].mallCityList);
                    } else {
                        $form.find('select[name=city]').parent().hide();
                    }
                });
            }
            //加载市数据
            function loadCity(citys) {
                var cityHtml = '';
                for (var i = 0; i < citys.length; i++) {
                    cityHtml += '<option value="' + citys[i].cityCode + '_' + citys[i].mallAreaList.length + '_' + i + '">' + citys[i].cityName + '</option>';
                }
                $form.find('select[name=city]').html(cityHtml).parent().show();
                form.render();
                form.on('select(city)', function(data) {
                    var value = data.value;
                    var d = value.split('_');
                    var code = d[0];
                    var count = d[1];
                    var index = d[2];
                    if (count > 0) {
                        loadArea(citys[index].mallAreaList);
                    } else {
                        $form.find('select[name=area]').parent().hide();
                    }
                });
            }
            //加载县/区数据
            function loadArea(areas) {
                var areaHtml = '';
                for (var i = 0; i < areas.length; i++) {
                    areaHtml += '<option value="' + areas[i].areaCode + '">' + areas[i].areaName + '</option>';
                }
                $form.find('select[name=area]').html(areaHtml).parent().show();
                form.render();
                form.on('select(area)', function(data) {
                    //console.log(data);
                });
            }
        };
        $scope.init();
    });
    app.controller('wayBillBoard',function($scope){
            $scope.init = function(){
                // 基于准备好的dom，初始化echarts实例
                var myChartSta = echarts.init(document.getElementById('Reportform-state'));
                var myChartCur = echarts.init(document.getElementById('Reportform-curve'));

                // 指定图表的配置项和数据
                var optionSta = {
                    title : {
                        text: '运单状态',
                        subtext: '纯属虚构',
                        x:'center'
                    },
                    tooltip : {
                        trigger: 'item',
                        formatter: "{a} <br/>{b} : {c} ({d}%)"
                    },
                    legend: {
                        orient: 'vertical',
                        left: 'left-center',
                        data: ['新增','提交','已回单']
                    },
                    series : [
                        {
                            name: '运单状态',
                            type: 'pie',
                            radius : '55%',
                            center: ['50%', '60%'],
                            data:[
                                {value:156, name:'新增'},
                                {value:123, name:'提交'},
                                {value:234, name:'已回单'},
//                    {value:135, name:'视频广告'},
//                    {value:1548, name:'搜索引擎'}
                            ],
                            itemStyle: {
                                emphasis: {
                                    shadowBlur: 10,
                                    shadowOffsetX: 0,
                                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                                }
                            }
                        }
                    ]
                };

                var uploadedDataURL = "/asset/get/s/data-1480404354615-H1jtpscGe.csv";

                var optionCur = {
                    title: {
                        text: '运单数量结构图'
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        data: ['运单曲线']
                    },
                    toolbox: {
                        feature: {
                            saveAsImage: {}
                        }
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    xAxis: [{
                        type: 'category',
                        boundaryGap: false,
                        data: ['3-27', '3-28', '3-29', '3-30', '3-31', '4-01', '4-06', '4-17', '4-18', '4-24', '4-25', '5-04', '5-15', '5-19']
                    }],
                    yAxis: [{
                        type: 'value'
                    }],
                    series: [{
                        name: '总单数',
                        type: 'line',
                        stack: '总量',
                        smooth:true,
                        label: {
                            normal: {
                                show: true,
                                position: 'top'
                            }
                        },
                        areaStyle: {   //控制图形阴影面积的颜色
                            normal: {
                                color: 'RGB(207,231,255)'
                            }
                        },
                        lineStyle: {   //控制显得颜色
                            normal: {
                                color: 'RGB(207,231,255)'
                            }
                        },
                        itemStyle: {   //控制提示的颜色
                            normal: {
//                                color: 'RGB(207,231,255)'
                            }
                        },
                        data: [5, 2, 20, 35, 4, 3, 2, 2, 5, 5, 2, 23, 35, 11]
                    }]
                };

                // 使用刚指定的配置项和数据显示图表。
                myChartSta.setOption(optionSta);
                myChartCur.setOption(optionCur);
            };
            $scope.init();
    });
    app.controller('addWayBill',['$scope',function($scope){
        $scope.init = function(){
            var Area ={};
            alert(1);
            $.post('../common/provincialLinkage/area.js',{},function (rsq) {
                Area = rsq;
            });
            var areaData = Area;
            var $form;
            var form;
            var $;   //  省市区
            console.log(Area);
            // 基于准备好的dom，初始化echarts实例
            var str ='';
            $.post('./template/addWayBill.html',{},function(rsq){
                str = rsq;
            });
            layui.use(['layer','form','layedit','laydate','jquery'], function(){ //独立版的layer无需执行这一句
                var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句

                var form = layui.form()
                    ,layer = layui.layer
                    ,layedit = layui.layedit
                    ,laydate = layui.laydate;

                $ = layui.jquery;
                $form = $('form');
                loadProvince();
                //弹框触发事件
                var active = {
                    setTop: function(){
                        var that = this;

                    }
                    ,offset: function(othis){
                        var type = othis.data('type')
                            ,text = othis.text();
                        layer.open({
                            title :'添加运单详情',
                            type: 1
                            ,area : ['1030px','500px']
                            ,offset: type //具体配置参考：http://www.layui.com/doc/modules/layer.html#offset
                            ,id: 'LAY_demo'+type //防止重复弹出
//                        ,content: ''
//                        ,content: './template/ceshi.html'
                            ,content: str
                            ,btn: ['取消','确认']
                            ,btnAlign: 'c' //按钮居中
                            ,shade: ['0.3','#000000'] //不显示遮罩
                            ,yes: function(){
                                layer.closeAll();
                            }
                        });
                    }
                };

                $('.site-demo-button .layui-btn').on('click', function(){
                    var othis = $(this), method = othis.data('method');
                    active[method] ? active[method].call(this, othis) : '';
                });

            }); // script wenjian

//                省市区三级联动

            //加载省数据
            function loadProvince() {
                var proHtml = '';
                for (var i = 0; i < areaData.length; i++) {
                    proHtml += '<option value="' + areaData[i].provinceCode + '_' + areaData[i].mallCityList.length + '_' + i + '">' + areaData[i].provinceName + '</option>';
                }
                //初始化省数据
                $form.find('select[name=province]').append(proHtml);
                form.render();
                form.on('select(province)', function(data) {
                    $form.find('select[name=area]').html('<option value="">请选择县/区</option>').parent().hide();
                    var value = data.value;
                    var d = value.split('_');
                    var code = d[0];
                    var count = d[1];
                    var index = d[2];
                    if (count > 0) {
                        loadCity(areaData[index].mallCityList);
                    } else {
                        $form.find('select[name=city]').parent().hide();
                    }
                });
            }
            //加载市数据
            function loadCity(citys) {
                var cityHtml = '';
                for (var i = 0; i < citys.length; i++) {
                    cityHtml += '<option value="' + citys[i].cityCode + '_' + citys[i].mallAreaList.length + '_' + i + '">' + citys[i].cityName + '</option>';
                }
                $form.find('select[name=city]').html(cityHtml).parent().show();
                form.render();
                form.on('select(city)', function(data) {
                    var value = data.value;
                    var d = value.split('_');
                    var code = d[0];
                    var count = d[1];
                    var index = d[2];
                    if (count > 0) {
                        loadArea(citys[index].mallAreaList);
                    } else {
                        $form.find('select[name=area]').parent().hide();
                    }
                });
            }
            //加载县/区数据
            function loadArea(areas) {
                var areaHtml = '';
                for (var i = 0; i < areas.length; i++) {
                    areaHtml += '<option value="' + areas[i].areaCode + '">' + areas[i].areaName + '</option>';
                }
                $form.find('select[name=area]').html(areaHtml).parent().show();
                form.render();
                form.on('select(area)', function(data) {
                    //console.log(data);
                });
            }
        };
        $scope.init();
    }]);
    app.controller('waybillManagement',['$scope',function($scope){
        $scope.init = function(){
            $(function(){
                $('#tms-wbm-fun li').each(function(i,obj){
                    $(obj).click(function(){
                        $('.tms-wbm-same').css({top:'157px',opacity:0,'z-index':99});
                        $('.tms-wbm-tip'+i).animate({top:'34px',opacity:1},500);
                    })
                });
                $('#tms-wbm-fun').hover(function(){},function(){
                    $('.tms-wbm-same').css({top:'157px',opacity:0,'z-index':-99});

                });
                $('#tms-wbm-refresh').click(function(){
                    $('#tms-wbm-refresh').val('&#x1002;');

                });
            });

            var str ='';
            $.post('./template/addWayBill.html',{},function(rsq){
                str = rsq;
            });
            var areaData = {};
//                var $form;
//                var form;
            $.post('../common/provincialLinkage/area.js',{},function(rsp){
                eval(rsp);
                areaData =Area;
            });
//                分页
            layui.use(['laypage', 'layer','form','element','layedit','laydate','jquery'], function() {
                var laypage = layui.laypage,
                    layer = layui.layer,
                    $ = layui.jquery,
                    form = layui.form(),
                    element = layui.element(),
                    $form = $('form');
                loadProvince();
                laypage({
                    cont: 'demo7'
                    , pages: 100
                    , skip: true
                });

                //监听导航点击
                element.on('nav(demo)', function(elem){
                    //console.log(elem)
                    layer.msg(elem.text());
                });

                //表格全选
                form.on('checkbox(allChoose)', function(data){
                    var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]');
                    child.each(function(index, item){
                        item.checked = data.elem.checked;
                    });
                    form.render('checkbox');
                });

                //弹框触发事件
                var active = {
                    setTop: function(){
                        var that = this;

                    }
                    ,offset: function(othis){
                        var type = othis.data('type')
                            ,text = othis.text();
                        layer.open({
                            title :'添加运单详情',
                            type: 1
                            ,area : ['1030px','500px']
                            ,offset: type //具体配置参考：http://www.layui.com/doc/modules/layer.html#offset
                            ,id: 'LAY_demo'+type //防止重复弹出
//                        ,content: ''
//                        ,content: './template/ceshi.html'
                            ,content: str
                            ,btn: ['取消','确认']
                            ,btnAlign: 'c' //按钮居中
                            ,shade: ['0.3','#000000'] //不显示遮罩
                            ,yes: function(){
                                layer.closeAll();
                            }
                        });
                    }
                };

                function laybtn( element){
                    var othis = $(element), method = othis.data('method');
                    active[method] ? active[method].call(this, othis) : '';
                }

                $('.site-demo-button .layui-btn').on('click', function(){
                    var othis = $(this), method = othis.data('method');
                    active[method] ? active[method].call(this, othis) : '';
                });

                //                省市区三级联动函数

                //加载省数据
                function loadProvince() {
                    var proHtml = '';
                    for (var i = 0; i < areaData.length; i++) {
                        proHtml += '<option value="' + areaData[i].provinceCode + '_' + areaData[i].mallCityList.length + '_' + i + '">' + areaData[i].provinceName + '</option>';
                    }
                    //初始化省数据
                    $form.find('select[name=province]').append(proHtml);
                    console.log( $('#asdfgh').html('12313') );
                    form.render();
                    form.on('select(province)', function(data) {
                        $form.find('select[name=area]').html('<option value="">请选择县/区</option>').parent().hide();
                        var value = data.value;
                        var d = value.split('_');
                        var code = d[0];
                        var count = d[1];
                        var index = d[2];
                        if (count > 0) {
                            loadCity(areaData[index].mallCityList);
                        } else {
                            $form.find('select[name=city]').parent().hide();
                        }
                    });
                }
                //加载市数据
                function loadCity(citys) {
                    var cityHtml = '';
                    for (var i = 0; i < citys.length; i++) {
                        cityHtml += '<option value="' + citys[i].cityCode + '_' + citys[i].mallAreaList.length + '_' + i + '">' + citys[i].cityName + '</option>';
                    }
                    $form.find('select[name=city]').html(cityHtml).parent().show();
                    form.render();
                    form.on('select(city)', function(data) {
                        var value = data.value;
                        var d = value.split('_');
                        var code = d[0];
                        var count = d[1];
                        var index = d[2];
                        if (count > 0) {
                            loadArea(citys[index].mallAreaList);
                        } else {
                            $form.find('select[name=area]').parent().hide();
                        }
                    });
                }
                //加载县/区数据
                function loadArea(areas) {
                    var areaHtml = '';
                    for (var i = 0; i < areas.length; i++) {
                        areaHtml += '<option value="' + areas[i].areaCode + '">' + areas[i].areaName + '</option>';
                    }
                    $form.find('select[name=area]').html(areaHtml).parent().show();
                    form.render();
                    form.on('select(area)', function(data) {
                        //console.log(data);
                    });
                }


            });
        };
        $scope.init();
    }]);
    app.controller('asideView',['$scope',function($scope){
        $scope.init = function(){
            layui.use(['tree', 'layer'], function(){
                var layer = layui.layer
                    ,$ = layui.jquery;

                layui.tree({
                    elem: '#demo1' //指定元素
                    ,target: '_blank' //是否新选项卡打开（比如节点返回href才有效）
                    ,click: function(item){ //点击节点回调
//                            alert(1);
//                            layer.msg('当前节名称：'+ item.name + '<br>全部参数：'+ JSON.stringify(item));
//                            console.log(item);
                        var num = item.id;
                        switch( num ){
                            case  21 :
                                alert(1);

                        }
                    }
                    ,nodes: [ //节点
                        {
                            name: '运输订单管理'
                            ,id: 2
//                                ,spread: true  //是否展开
                            ,children: [
                            {
                                name: '运单看板'
                                ,id: 21
//                                        ,spread: true
                            }, {
                                name: '运单弹出框'
                                ,id: 22
                            }, {
                                name: '运单管理'
                                ,id: 23
                            },{
                                name : '运单在途信息'
                                ,id : 24
                            }
                        ]
                        }, {
                            name: '运单任务管理'
                            ,id: 2
                            ,children: [
                                {
                                    name: '运输任务管理'
                                    ,id: 31
                                }, {
                                    name: '质量检测'
                                    ,id: 32
                                }
                            ]
                        },{
                            name : '配载调度管理'
                            ,id : '4'
                            ,children : [
                                {
                                    name : '提车/移库调度管理工作台'
                                    ,id : '41'
                                },{
                                    name : '人送调度工作台'
                                    ,id : '42'
                                },{
                                    name : '配载调度台'
                                    ,id : '43'
                                }
                            ]
                        },{
                            name : '派车单管理'
                            ,id : '5'
                            ,children : [
                                {
                                    name : '派车单管理'
                                    ,id : '51'
                                },{
                                    name : '派车单跟踪'
                                    ,id  : '52'
                                }
                            ]
                        },{
                            name : '装卸管理'
                            ,id : '6'
                            ,children : [
                                {
                                    name : '装车管理'
                                    ,id : '61'
                                },{
                                    name : '派车单跟踪'
                                    ,id : '62'
                                }
                            ]
                        },{
                            name : '回单管理',
                            id : '7'
                            ,children : [
                                {
                                    name : '回单管理'
                                    ,id  : '71'
                                }
                            ]
                        },{
                            name : '规则策略管理',
                            id: '8',
                            children : [
                                {
                                    name : '调度工作台策略'
                                    ,id : '81'
                                }
                            ]
                        },{
                            name : '异常处理'
                            ,id : '9'
                            ,children : [
                                {
                                    name : '异常处理'
                                    ,id : '91'
                                }
                            ]
                        },{
                            name : '日志管理'
                            ,id : '10'
                            ,children : [
                                {
                                    name : '操作日志管理'
                                    ,id : '101'
                                } ,{
                                    name : '接口日志管理'
                                    ,id : '102'
                                }
                            ]
                        }
                    ]

                });
            });
        };
        $scope.init();
    }]);
    app.controller('provincialLinkage',['$scope',function($scope){
        $scope.init = function(){
            //初始数据
            var areaData = Area;
            var $form;
            var form;
            var $;
            layui.use(['jquery', 'form'], function() {
                $ = layui.jquery;
                form = layui.form();
                $form = $('form');
                loadProvince();
            });
            //加载省数据
            function loadProvince() {
                var proHtml = '';
                for (var i = 0; i < areaData.length; i++) {
                    proHtml += '<option value="' + areaData[i].provinceCode + '_' + areaData[i].mallCityList.length + '_' + i + '">' + areaData[i].provinceName + '</option>';
                }
                //初始化省数据
                $form.find('select[name=province]').append(proHtml);
                form.render();
                form.on('select(province)', function(data) {
                    $form.find('select[name=area]').html('<option value="">请选择县/区</option>').parent().hide();
                    var value = data.value;
                    var d = value.split('_');
                    var code = d[0];
                    var count = d[1];
                    var index = d[2];
                    if (count > 0) {
                        loadCity(areaData[index].mallCityList);
                    } else {
                        $form.find('select[name=city]').parent().hide();
                    }
                });
            }
            //加载市数据
            function loadCity(citys) {
                var cityHtml = '';
                for (var i = 0; i < citys.length; i++) {
                    cityHtml += '<option value="' + citys[i].cityCode + '_' + citys[i].mallAreaList.length + '_' + i + '">' + citys[i].cityName + '</option>';
                }
                $form.find('select[name=city]').html(cityHtml).parent().show();
                form.render();
                form.on('select(city)', function(data) {
                    var value = data.value;
                    var d = value.split('_');
                    var code = d[0];
                    var count = d[1];
                    var index = d[2];
                    if (count > 0) {
                        loadArea(citys[index].mallAreaList);
                    } else {
                        $form.find('select[name=area]').parent().hide();
                    }
                });
            }
            //加载县/区数据
            function loadArea(areas) {
                var areaHtml = '';
                for (var i = 0; i < areas.length; i++) {
                    areaHtml += '<option value="' + areas[i].areaCode + '">' + areas[i].areaName + '</option>';
                }
                $form.find('select[name=area]').html(areaHtml).parent().show();
                form.render();
                form.on('select(area)', function(data) {
                    //console.log(data);
                });
            }
        };
        $scope.init();
    }]);
    app.controller('transportationTaskManagement',['$scope',function($scope){
        $scope.init = function(){
            $(function(){
                $('#tms-wbm-fun li').each(function(i,obj){
                    $(obj).click(function(){
                        $('.tms-wbm-same').css({top:'157px',opacity:0,'z-index':99});
                        $('.tms-wbm-tip'+i).animate({top:'34px',opacity:1},500);
                    })
                });
                $('#tms-wbm-fun').hover(function(){},function(){
                    $('.tms-wbm-same').css({top:'157px',opacity:0,'z-index':-99});

                });
                $('#tms-wbm-refresh').click(function(){
                    $('#tms-wbm-refresh').val('&#x1002;');

                });
            });

            //                分页
            layui.use(['laypage', 'layer', 'form', 'element', 'layedit', 'laydate', 'jquery'], function () {
                var laypage = layui.laypage,
                    layer = layui.layer,
                    $ = layui.jquery,
                    form = layui.form(),
                    element = layui.element(),
                    $form = $('form');
                laypage({
                    cont: 'demo8'
                    , pages: 100
                    , skip: true
                });

                //监听导航点击
                element.on('nav(demo)', function (elem) {
                    //console.log(elem)
                    layer.msg(elem.text());
                });

                //表格全选
                form.on('checkbox(allChoose)', function (data) {
                    var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]');
                    child.each(function (index, item) {
                        item.checked = data.elem.checked;
                    });
                    form.render('checkbox');
                });
            });
        };
        $scope.init();
    }]);
    app.controller('qualityQrediction',['$scope',function($scope){
        $scope.init = function(){
            layui.use('element', function(){
                var element = layui.element();
            });
            var myChartEstL = echarts.init(document.getElementById('tms-qqd-bf-left-id'));
            var myChartEstR = echarts.init(document.getElementById('tms-qqd-bf-right-id'));
            var myChartCirEst = echarts.init(document.getElementById('tms-qqd-table-cir-est'));
            var myChartCirSend = echarts.init(document.getElementById('tms-qqd-table-cir-send'));
            var myChartCirEstSend = echarts.init(document.getElementById('tms-qqd-table-cir-estsend'));
            optionEstimateL = {
                color: ['#3398DB'],
                tooltip : {
                    trigger: 'axis',
                    axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                        type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis : [
                    {
                        type : 'category',
                        data : ['江铃主机厂，皮卡', 'XX库，轿车', 'AA主机厂'],
                        axisTick: {
                            alignWithLabel: true
                        }
                    }
                ],
                yAxis : [
                    {
                        type : 'value'
                    }
                ],
                series : [
                    {
                        name:'预计到货量',
                        type:'bar',
                        barWidth: '60%',
                        data:[20, 30, 40]
                    }
                ]
            };
            optionEstimateR = {
                color: ['#3398DB'],
                tooltip : {
                    trigger: 'axis',
                    axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                        type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis : [
                    {
                        type : 'category',
                        data : ['深圳，一板轿车', '广州，一板轿车', '深圳，JMC12','西安，轿车'],
                        axisTick: {
                            alignWithLabel: true
                        }
                    }
                ],
                yAxis : [
                    {
                        type : 'value'
                    }
                ],
                series : [
                    {
                        name:'预计发货量',
                        type:'bar',
                        barWidth: '60%',
                        data:[8, 8, 12,23]
                    }
                ]
            };
            var optionCirEst = {
                title : {
                    text: '预计到货量',
                    subtext: '2017-06-12',
                    x:'center'
                },
                tooltip : {
                    trigger: 'item',
                    formatter: "{a} <br/>{b} : {c} ({d}%)"
                },
//                    legend: {
//                        orient: 'vertical',
//                        left: 'left-center',
//                        data: ['皮卡','轿车','JMC']
//                    },
                series : [
                    {
                        name: '运单状态',
                        type: 'pie',
                        radius : '55%',
                        center: ['50%', '60%'],
                        data:[
                            {value:20, name:'皮卡'},
                            {value:30, name:'轿车'},
                            {value:40, name:'JMC'},
//                    {value:135, name:'视频广告'},
//                    {value:1548, name:'搜索引擎'}
                        ],
                        itemStyle: {
                            emphasis: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
            };
            var optionCirSend = {
                title : {
                    text: '已发货量',
                    subtext: '2017-06-12',
                    x:'center'
                },
                tooltip : {
                    trigger: 'item',
                    formatter: "{a} <br/>{b} : {c} ({d}%)"
                },
//                    legend: {
//                        orient: 'vertical',
//                        left: 'left-center',
//                        data: ['皮卡','轿车','JMC']
//                    },
                series : [
                    {
                        name: '运单状态',
                        type: 'pie',
                        radius : '55%',
                        center: ['50%', '60%'],
                        data:[
                            {value:8, name:'皮卡'},
                            {value:8, name:'轿车'}
//                    {value:135, name:'视频广告'},
//                    {value:1548, name:'搜索引擎'}
                        ],
                        itemStyle: {
                            emphasis: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
            };
            var optionCirEstSend = {
                title : {
                    text: '预计发货量',
                    subtext: '2017-06-12',
                    x:'center'
                },
                tooltip : {
                    trigger: 'item',
                    formatter: "{a} <br/>{b} : {c} ({d}%)"
                },
//                    legend: {
//                        orient: 'vertical',
//                        left: 'left-center',
//                        data: ['皮卡','轿车','JMC']
//                    },
                series : [
                    {
                        name: '运单状态',
                        type: 'pie',
                        radius : '55%',
                        center: ['50%', '60%'],
                        data:[
                            {value:20, name:'皮卡'},
                            {value:30, name:'轿车'},
                            {value:40, name:'JMC'},
//                    {value:135, name:'视频广告'},
//                    {value:1548, name:'搜索引擎'}
                        ],
                        itemStyle: {
                            emphasis: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
            };
            myChartEstL.setOption(optionEstimateL);
            myChartEstR.setOption(optionEstimateR);
            myChartCirEst.setOption(optionCirEst);
            myChartCirSend.setOption(optionCirSend);
            myChartCirEstSend.setOption(optionCirEstSend);
        };
        $scope.init();
    }]);
    app.controller('deliverySchedulingDesk',['$scope',function($scope){
        $scope.init = function(){};
        $scope.init();
    }]);
    app.directive('wayBillBoard',function() {
        // 将对象return出去
        return{
            restrict: 'EAC',// 指令类型  E：element A：attribute M：comment C: class
            scope :{
                asd : '='
            },
            templateUrl: './template/WaybillBoard.html',
            replace: true, //使用模板替换原始标记  指令内原本的数据将被清空
            link : function($scope, $element, attr){
                // 基于准备好的dom，初始化echarts实例
                var myChartSta = echarts.init(document.getElementById('Reportform-state'));
                var myChartCur = echarts.init(document.getElementById('Reportform-curve'));

                // 指定图表的配置项和数据
                var optionSta = {
                    title : {
                        text: '运单状态',
                        subtext: '纯属虚构',
                        x:'center'
                    },
                    tooltip : {
                        trigger: 'item',
                        formatter: "{a} <br/>{b} : {c} ({d}%)"
                    },
                    legend: {
                        orient: 'vertical',
                        left: 'left-center',
                        data: ['新增','提交','已回单']
                    },
                    series : [
                        {
                            name: '运单状态',
                            type: 'pie',
                            radius : '55%',
                            center: ['50%', '60%'],
                            data:[
                                {value:156, name:'新增'},
                                {value:123, name:'提交'},
                                {value:234, name:'已回单'},
//                    {value:135, name:'视频广告'},
//                    {value:1548, name:'搜索引擎'}
                            ],
                            itemStyle: {
                                emphasis: {
                                    shadowBlur: 10,
                                    shadowOffsetX: 0,
                                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                                }
                            }
                        }
                    ]
                };

                var uploadedDataURL = "/asset/get/s/data-1480404354615-H1jtpscGe.csv";

                var optionCur = {
                    title: {
                        text: '运单数量结构图'
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        data: ['运单曲线']
                    },
                    toolbox: {
                        feature: {
                            saveAsImage: {}
                        }
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    xAxis: [{
                        type: 'category',
                        boundaryGap: false,
                        data: ['3-27', '3-28', '3-29', '3-30', '3-31', '4-01', '4-06', '4-17', '4-18', '4-24', '4-25', '5-04', '5-15', '5-19']
                    }],
                    yAxis: [{
                        type: 'value'
                    }],
                    series: [{
                        name: '总单数',
                        type: 'line',
                        stack: '总量',
                        smooth:true,
                        label: {
                            normal: {
                                show: true,
                                position: 'top'
                            }
                        },
                        areaStyle: {   //控制图形阴影面积的颜色
                            normal: {
                                color: 'RGB(207,231,255)'
                            }
                        },
                        lineStyle: {   //控制显得颜色
                            normal: {
                                color: 'RGB(207,231,255)'
                            }
                        },
                        itemStyle: {   //控制提示的颜色
                            normal: {
//                                color: 'RGB(207,231,255)'
                            }
                        },
                        data: [5, 2, 20, 35, 4, 3, 2, 2, 5, 5, 2, 23, 35, 11]
                    }]
                };

                // 使用刚指定的配置项和数据显示图表。
                myChartSta.setOption(optionSta);
                myChartCur.setOption(optionCur);

            }
    }
    });
    app.directive('addWayBill',function(){
        return {
            restrict: 'EAC',// 指令类型  E：element A：attribute M：comment C: class
            scope: {
                asd: '='
            },
            templateUrl: './template/ceshi.html',
            replace: true, //使用模板替换原始标记  指令内原本的数据将被清空
            link: function ($scope, $element, attr) {
                var Area ={};
                alert(1);
                $.post('../common/provincialLinkage/area.js',{},function (rsq) {
                        Area = rsq;
                });
                var areaData = Area;
                var $form;
                var form;
                var $;   //  省市区
                console.log(Area);
                // 基于准备好的dom，初始化echarts实例
                var str ='';
                $.post('./template/addWayBill.html',{},function(rsq){
                    str = rsq;
                });
                    layui.use(['layer','form','layedit','laydate','jquery'], function(){ //独立版的layer无需执行这一句
                    var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句

                        var form = layui.form()
                            ,layer = layui.layer
                            ,layedit = layui.layedit
                            ,laydate = layui.laydate;

                            $ = layui.jquery;
                            $form = $('form');
                            loadProvince();
                        //弹框触发事件
                    var active = {
                    setTop: function(){
                    var that = this;

                }
                    ,offset: function(othis){
                    var type = othis.data('type')
                    ,text = othis.text();
                    layer.open({
                        title :'添加运单详情',
                        type: 1
                        ,area : ['1030px','500px']
                        ,offset: type //具体配置参考：http://www.layui.com/doc/modules/layer.html#offset
                        ,id: 'LAY_demo'+type //防止重复弹出
//                        ,content: ''
//                        ,content: './template/ceshi.html'
                        ,content: str
                        ,btn: ['取消','确认']
                        ,btnAlign: 'c' //按钮居中
                        ,shade: ['0.3','#000000'] //不显示遮罩
                        ,yes: function(){
                        layer.closeAll();
                }
                });
                }
                };

                    $('.site-demo-button .layui-btn').on('click', function(){
                    var othis = $(this), method = othis.data('method');
                    active[method] ? active[method].call(this, othis) : '';
                });

                }); // script wenjian

//                省市区三级联动

                //加载省数据
                function loadProvince() {
                    var proHtml = '';
                    for (var i = 0; i < areaData.length; i++) {
                        proHtml += '<option value="' + areaData[i].provinceCode + '_' + areaData[i].mallCityList.length + '_' + i + '">' + areaData[i].provinceName + '</option>';
                    }
                    //初始化省数据
                    $form.find('select[name=province]').append(proHtml);
                    form.render();
                    form.on('select(province)', function(data) {
                        $form.find('select[name=area]').html('<option value="">请选择县/区</option>').parent().hide();
                        var value = data.value;
                        var d = value.split('_');
                        var code = d[0];
                        var count = d[1];
                        var index = d[2];
                        if (count > 0) {
                            loadCity(areaData[index].mallCityList);
                        } else {
                            $form.find('select[name=city]').parent().hide();
                        }
                    });
                }
                //加载市数据
                function loadCity(citys) {
                    var cityHtml = '';
                    for (var i = 0; i < citys.length; i++) {
                        cityHtml += '<option value="' + citys[i].cityCode + '_' + citys[i].mallAreaList.length + '_' + i + '">' + citys[i].cityName + '</option>';
                    }
                    $form.find('select[name=city]').html(cityHtml).parent().show();
                    form.render();
                    form.on('select(city)', function(data) {
                        var value = data.value;
                        var d = value.split('_');
                        var code = d[0];
                        var count = d[1];
                        var index = d[2];
                        if (count > 0) {
                            loadArea(citys[index].mallAreaList);
                        } else {
                            $form.find('select[name=area]').parent().hide();
                        }
                    });
                }
                //加载县/区数据
                function loadArea(areas) {
                    var areaHtml = '';
                    for (var i = 0; i < areas.length; i++) {
                        areaHtml += '<option value="' + areas[i].areaCode + '">' + areas[i].areaName + '</option>';
                    }
                    $form.find('select[name=area]').html(areaHtml).parent().show();
                    form.render();
                    form.on('select(area)', function(data) {
                        //console.log(data);
                    });
                }

            }
        }
    });
    app.directive('waybillManagement',function(){
        return {
            restrict: 'EAC',// 指令类型  E：element A：attribute M：comment C: class
            scope: {
                asd: '='
            },
            templateUrl: './template/waybillManagement.html',
            replace: true, //使用模板替换原始标记  指令内原本的数据将被清空
            link: function ($scope, $element, attr) {
                $(function(){
                    $('#tms-wbm-fun li').each(function(i,obj){
                        $(obj).click(function(){
                            $('.tms-wbm-same').css({top:'157px',opacity:0,'z-index':99});
                            $('.tms-wbm-tip'+i).animate({top:'34px',opacity:1},500);
                        })
                    });
                    $('#tms-wbm-fun').hover(function(){},function(){
                        $('.tms-wbm-same').css({top:'157px',opacity:0,'z-index':-99});

                    });
                    $('#tms-wbm-refresh').click(function(){
                        $('#tms-wbm-refresh').val('&#x1002;');

                    });
                });

                var str ='';
                $.post('./template/addWayBill.html',{},function(rsq){
                    str = rsq;
                });
                var areaData = {};
//                var $form;
//                var form;
                $.post('../common/provincialLinkage/area.js',{},function(rsp){
                    eval(rsp);
                    areaData =Area;
                });
//                分页
                layui.use(['laypage', 'layer','form','element','layedit','laydate','jquery'], function() {
                    var laypage = layui.laypage,
                        layer = layui.layer,
                        $ = layui.jquery,
                        form = layui.form(),
                        element = layui.element(),
                        $form = $('form');
                        loadProvince();
                    laypage({
                        cont: 'demo7'
                        , pages: 100
                        , skip: true
                    });

                    //监听导航点击
                    element.on('nav(demo)', function(elem){
                        //console.log(elem)
                        layer.msg(elem.text());
                    });

                    //表格全选
                    form.on('checkbox(allChoose)', function(data){
                        var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]');
                        child.each(function(index, item){
                            item.checked = data.elem.checked;
                        });
                        form.render('checkbox');
                    });

                    //弹框触发事件
                    var active = {
                        setTop: function(){
                            var that = this;

                        }
                        ,offset: function(othis){
                            var type = othis.data('type')
                                ,text = othis.text();
                            layer.open({
                                title :'添加运单详情',
                                type: 1
                                ,area : ['1030px','500px']
                                ,offset: type //具体配置参考：http://www.layui.com/doc/modules/layer.html#offset
                                ,id: 'LAY_demo'+type //防止重复弹出
//                        ,content: ''
//                        ,content: './template/ceshi.html'
                                ,content: str
                                ,btn: ['取消','确认']
                                ,btnAlign: 'c' //按钮居中
                                ,shade: ['0.3','#000000'] //不显示遮罩
                                ,yes: function(){
                                    layer.closeAll();
                                }
                            });
                        }
                    };

                       function laybtn( element){
                           var othis = $(element), method = othis.data('method');
                           active[method] ? active[method].call(this, othis) : '';
                       }

                    $('.site-demo-button .layui-btn').on('click', function(){
                        var othis = $(this), method = othis.data('method');
                        active[method] ? active[method].call(this, othis) : '';
                    });

                    //                省市区三级联动函数

                    //加载省数据
                    function loadProvince() {
                        var proHtml = '';
                        for (var i = 0; i < areaData.length; i++) {
                            proHtml += '<option value="' + areaData[i].provinceCode + '_' + areaData[i].mallCityList.length + '_' + i + '">' + areaData[i].provinceName + '</option>';
                        }
                        //初始化省数据
                        $form.find('select[name=province]').append(proHtml);
                        console.log( $('#asdfgh').html('12313') );
                        form.render();
                        form.on('select(province)', function(data) {
                            $form.find('select[name=area]').html('<option value="">请选择县/区</option>').parent().hide();
                            var value = data.value;
                            var d = value.split('_');
                            var code = d[0];
                            var count = d[1];
                            var index = d[2];
                            if (count > 0) {
                                loadCity(areaData[index].mallCityList);
                            } else {
                                $form.find('select[name=city]').parent().hide();
                            }
                        });
                    }
                    //加载市数据
                    function loadCity(citys) {
                        var cityHtml = '';
                        for (var i = 0; i < citys.length; i++) {
                            cityHtml += '<option value="' + citys[i].cityCode + '_' + citys[i].mallAreaList.length + '_' + i + '">' + citys[i].cityName + '</option>';
                        }
                        $form.find('select[name=city]').html(cityHtml).parent().show();
                        form.render();
                        form.on('select(city)', function(data) {
                            var value = data.value;
                            var d = value.split('_');
                            var code = d[0];
                            var count = d[1];
                            var index = d[2];
                            if (count > 0) {
                                loadArea(citys[index].mallAreaList);
                            } else {
                                $form.find('select[name=area]').parent().hide();
                            }
                        });
                    }
                    //加载县/区数据
                    function loadArea(areas) {
                        var areaHtml = '';
                        for (var i = 0; i < areas.length; i++) {
                            areaHtml += '<option value="' + areas[i].areaCode + '">' + areas[i].areaName + '</option>';
                        }
                        $form.find('select[name=area]').html(areaHtml).parent().show();
                        form.render();
                        form.on('select(area)', function(data) {
                            //console.log(data);
                        });
                    }


                });
            }
        }
    });
    app.directive('1asideView',function(){
        // 将对象return出去
        return {
            restrict: 'EAC',// 指令类型  E：element A：attribute M：comment C: class
            scope: {
                asd: '='
            },
            templateUrl: './template/aside-view.html',
            replace: false, //使用模板替换原始标记  指令内原本的数据将被清空
            link: function ($scope, $element, attr) {
                layui.use(['tree', 'layer'], function(){
                    var layer = layui.layer
                        ,$ = layui.jquery;

                    layui.tree({
                        elem: '#demo1' //指定元素
                        ,target: '_blank' //是否新选项卡打开（比如节点返回href才有效）
                        ,click: function(item){ //点击节点回调
//                            alert(1);
//                            layer.msg('当前节名称：'+ item.name + '<br>全部参数：'+ JSON.stringify(item));
//                            console.log(item);
                            var num = item.id;
                            switch( num ){
                                case  21 :
                                   break;
                                case 22 :
                                    $rootScope.gohref('waybillManagement');
                                    break;
                                case 23 :
                                    $scope.go('');
                                    break;
                                case 31 :
                                    gohref('transportationTaskManagement');
                                    break;
                                case 32 :
                                    $scope.go('qualityQrediction');
                                    break;
                                case 41 :
                                    $scope.go('deliverySchedulingDesk');
                                    break;
                            }
                        }
                        ,nodes: [ //节点
                            {
                                name: '运输订单管理'
                                ,id: 2
//                                ,spread: true  //是否展开
                                ,children: [
                                    {
                                        name: '运单看板'
                                        ,id: 21
//                                        ,spread: true
                                        }, {
                                            name: '运单管理'
                                            ,id: 22
                                        },{
                                            name : '运单在途跟踪'
                                            ,id : 23
                                        }
                                    ]
                                    }, {
                                        name: '运单任务管理'
                                        ,id: 2
                                        ,children: [
                                            {
                                                name: '运输任务管理'
                                                ,id: 31
                                            }, {
                                                name: '质量检测'
                                                ,id: 32
                                            }
                                        ]
                                    },{
                                        name : '配载调度管理'
                                        ,id : '4'
                                        ,children : [
                                            {
                                                name : '提货调度工作台'
                                                ,id : '41'
                                            },{
                                                name : '人送调度工作台'
                                                ,id : '42'
                                            },{
                                                name : '配载调度工作台'
                                                ,id : '43'
                                            }
                                        ]
                                    },{
                                        name : '派车单管理'
                                        ,id : '5'
                                        ,children : [
                                            {
                                                name : '派车单管理'
                                                ,id : '51'
                                            },{
                                                name : '派车单跟踪'
                                                ,id  : '52'
                                            }
                                         ]
                                    },{
                                         name : '装卸管理'
                                         ,id : '6'
                                         ,children : [
                                            {
                                                name : '装车管理'
                                                ,id : '61'
                                            },{
                                                name : '派车单跟踪'
                                                ,id : '62'
                                             }
                                        ]
                                    },{
                                        name : '回单管理',
                                        id : '7'
                                        ,children : [
                                            {
                                                name : '回单管理'
                                                ,id  : '71'
                                            }
                                ]
                                    },{
                                        name : '规则策略管理',
                                        id: '8',
                                        children : [
                                            {
                                                name : '调度工作台策略'
                                                ,id : '81'
                                            }
                                        ]
                                    },{
                                        name : '异常处理'
                                        ,id : '9'
                                        ,children : [
                                            {
                                                name : '异常处理'
                                                ,id : '91'
                                            }
                                        ]
                                    },{
                                        name : '日志管理'
                                        ,id : '10'
                                        ,children : [
                                            {
                                                name : '操作日志管理'
                                                ,id : '101'
                                            } ,{
                                                name : '接口日志管理'
                                                ,id : '102'
                                    }
                                ]
                                    }
                                ]

                    });
                });
            }
        }
    });
    app.directive('provincialLinkage',function(){
        return {
            restrict: 'EAC',// 指令类型  E：element A：attribute M：comment C: class
            scope: {
                asd: '='
            },
            templateUrl: '../common/provincialLinkage/provincialLinkage.html',
            replace: true, //使用模板替换原始标记  指令内原本的数据将被清空
            link: function ($scope, $element, attr) {
                //初始数据
                var areaData = Area;
                var $form;
                var form;
                var $;
                layui.use(['jquery', 'form'], function() {
                    $ = layui.jquery;
                    form = layui.form();
                    $form = $('form');
                    loadProvince();
                });
                //加载省数据
                function loadProvince() {
                    var proHtml = '';
                    for (var i = 0; i < areaData.length; i++) {
                        proHtml += '<option value="' + areaData[i].provinceCode + '_' + areaData[i].mallCityList.length + '_' + i + '">' + areaData[i].provinceName + '</option>';
                    }
                    //初始化省数据
                    $form.find('select[name=province]').append(proHtml);
                    form.render();
                    form.on('select(province)', function(data) {
                        $form.find('select[name=area]').html('<option value="">请选择县/区</option>').parent().hide();
                        var value = data.value;
                        var d = value.split('_');
                        var code = d[0];
                        var count = d[1];
                        var index = d[2];
                        if (count > 0) {
                            loadCity(areaData[index].mallCityList);
                        } else {
                            $form.find('select[name=city]').parent().hide();
                        }
                    });
                }
                //加载市数据
                function loadCity(citys) {
                    var cityHtml = '';
                    for (var i = 0; i < citys.length; i++) {
                        cityHtml += '<option value="' + citys[i].cityCode + '_' + citys[i].mallAreaList.length + '_' + i + '">' + citys[i].cityName + '</option>';
                    }
                    $form.find('select[name=city]').html(cityHtml).parent().show();
                    form.render();
                    form.on('select(city)', function(data) {
                        var value = data.value;
                        var d = value.split('_');
                        var code = d[0];
                        var count = d[1];
                        var index = d[2];
                        if (count > 0) {
                            loadArea(citys[index].mallAreaList);
                        } else {
                            $form.find('select[name=area]').parent().hide();
                        }
                    });
                }
                //加载县/区数据
                function loadArea(areas) {
                    var areaHtml = '';
                    for (var i = 0; i < areas.length; i++) {
                        areaHtml += '<option value="' + areas[i].areaCode + '">' + areas[i].areaName + '</option>';
                    }
                    $form.find('select[name=area]').html(areaHtml).parent().show();
                    form.render();
                    form.on('select(area)', function(data) {
                        //console.log(data);
                    });
                }
            }
        }
    });
    app.directive('transportationTaskManagement',function(){
        return {
            restrict: 'EAC',// 指令类型  E：element A：attribute M：comment C: class
            scope: {
                asd: '='
            },
            templateUrl: './template/transportationTaskManagement.html',
            replace: true, //使用模板替换原始标记  指令内原本的数据将被清空
            link: function ($scope, $element, attr) {

                $(function(){
                    $('#tms-wbm-fun li').each(function(i,obj){
                        $(obj).click(function(){
                            $('.tms-wbm-same').css({top:'157px',opacity:0,'z-index':99});
                            $('.tms-wbm-tip'+i).animate({top:'34px',opacity:1},500);
                        })
                    });
                    $('#tms-wbm-fun').hover(function(){},function(){
                        $('.tms-wbm-same').css({top:'157px',opacity:0,'z-index':-99});

                    });
                    $('#tms-wbm-refresh').click(function(){
                        $('#tms-wbm-refresh').val('&#x1002;');

                    });
                });

                //                分页
                layui.use(['laypage', 'layer', 'form', 'element', 'layedit', 'laydate', 'jquery'], function () {
                    var laypage = layui.laypage,
                        layer = layui.layer,
                        $ = layui.jquery,
                        form = layui.form(),
                        element = layui.element(),
                        $form = $('form');
                    laypage({
                        cont: 'demo8'
                        , pages: 100
                        , skip: true
                    });

                    //监听导航点击
                    element.on('nav(demo)', function (elem) {
                        //console.log(elem)
                        layer.msg(elem.text());
                    });

                    //表格全选
                    form.on('checkbox(allChoose)', function (data) {
                        var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]');
                        child.each(function (index, item) {
                            item.checked = data.elem.checked;
                        });
                        form.render('checkbox');
                    });
                });
            }
        }
    });
    app.directive('qualityQrediction',function(){
//            $scope.keke = [{name: '江铃库'},{name : '振铃库'},{name:'美丽'},{name:'撒旦'}];
        return {
            restrict: 'EAC',// 指令类型  E：element A：attribute M：comment C: class
            scope: {
                asd: '='
            },
            templateUrl: './template/qualityQrediction.html',
            replace: true, //使用模板替换原始标记  指令内原本的数据将被清空
            link: function ($scope, $element, attr) {
                layui.use('element', function(){
                    var element = layui.element();
                });
                var myChartEstL = echarts.init(document.getElementById('tms-qqd-bf-left-id'));
                var myChartEstR = echarts.init(document.getElementById('tms-qqd-bf-right-id'));
                var myChartCirEst = echarts.init(document.getElementById('tms-qqd-table-cir-est'));
                var myChartCirSend = echarts.init(document.getElementById('tms-qqd-table-cir-send'));
                var myChartCirEstSend = echarts.init(document.getElementById('tms-qqd-table-cir-estsend'));
                optionEstimateL = {
                    color: ['#3398DB'],
                    tooltip : {
                        trigger: 'axis',
                        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                        }
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    xAxis : [
                        {
                            type : 'category',
                            data : ['江铃主机厂，皮卡', 'XX库，轿车', 'AA主机厂'],
                            axisTick: {
                                alignWithLabel: true
                            }
                        }
                    ],
                    yAxis : [
                        {
                            type : 'value'
                        }
                    ],
                    series : [
                        {
                            name:'预计到货量',
                            type:'bar',
                            barWidth: '60%',
                            data:[20, 30, 40]
                        }
                    ]
                };
                optionEstimateR = {
                    color: ['#3398DB'],
                    tooltip : {
                        trigger: 'axis',
                        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                        }
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    xAxis : [
                        {
                            type : 'category',
                            data : ['深圳，一板轿车', '广州，一板轿车', '深圳，JMC12','西安，轿车'],
                            axisTick: {
                                alignWithLabel: true
                            }
                        }
                    ],
                    yAxis : [
                        {
                            type : 'value'
                        }
                    ],
                    series : [
                        {
                            name:'预计发货量',
                            type:'bar',
                            barWidth: '60%',
                            data:[8, 8, 12,23]
                        }
                    ]
                };
                var optionCirEst = {
                    title : {
                        text: '预计到货量',
                        subtext: '2017-06-12',
                        x:'center'
                    },
                    tooltip : {
                        trigger: 'item',
                        formatter: "{a} <br/>{b} : {c} ({d}%)"
                    },
//                    legend: {
//                        orient: 'vertical',
//                        left: 'left-center',
//                        data: ['皮卡','轿车','JMC']
//                    },
                    series : [
                        {
                            name: '运单状态',
                            type: 'pie',
                            radius : '55%',
                            center: ['50%', '60%'],
                            data:[
                                {value:20, name:'皮卡'},
                                {value:30, name:'轿车'},
                                {value:40, name:'JMC'},
//                    {value:135, name:'视频广告'},
//                    {value:1548, name:'搜索引擎'}
                            ],
                            itemStyle: {
                                emphasis: {
                                    shadowBlur: 10,
                                    shadowOffsetX: 0,
                                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                                }
                            }
                        }
                    ]
                };
                var optionCirSend = {
                    title : {
                        text: '已发货量',
                        subtext: '2017-06-12',
                        x:'center'
                    },
                    tooltip : {
                        trigger: 'item',
                        formatter: "{a} <br/>{b} : {c} ({d}%)"
                    },
//                    legend: {
//                        orient: 'vertical',
//                        left: 'left-center',
//                        data: ['皮卡','轿车','JMC']
//                    },
                    series : [
                        {
                            name: '运单状态',
                            type: 'pie',
                            radius : '55%',
                            center: ['50%', '60%'],
                            data:[
                                {value:8, name:'皮卡'},
                                {value:8, name:'轿车'}
//                    {value:135, name:'视频广告'},
//                    {value:1548, name:'搜索引擎'}
                            ],
                            itemStyle: {
                                emphasis: {
                                    shadowBlur: 10,
                                    shadowOffsetX: 0,
                                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                                }
                            }
                        }
                    ]
                };
                var optionCirEstSend = {
                    title : {
                        text: '预计发货量',
                        subtext: '2017-06-12',
                        x:'center'
                    },
                    tooltip : {
                        trigger: 'item',
                        formatter: "{a} <br/>{b} : {c} ({d}%)"
                    },
//                    legend: {
//                        orient: 'vertical',
//                        left: 'left-center',
//                        data: ['皮卡','轿车','JMC']
//                    },
                    series : [
                        {
                            name: '运单状态',
                            type: 'pie',
                            radius : '55%',
                            center: ['50%', '60%'],
                            data:[
                                {value:20, name:'皮卡'},
                                {value:30, name:'轿车'},
                                {value:40, name:'JMC'},
//                    {value:135, name:'视频广告'},
//                    {value:1548, name:'搜索引擎'}
                            ],
                            itemStyle: {
                                emphasis: {
                                    shadowBlur: 10,
                                    shadowOffsetX: 0,
                                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                                }
                            }
                        }
                    ]
                };
                myChartEstL.setOption(optionEstimateL);
                myChartEstR.setOption(optionEstimateR);
                myChartCirEst.setOption(optionCirEst);
                myChartCirSend.setOption(optionCirSend);
                myChartCirEstSend.setOption(optionCirEstSend);
            }
        }
    });
    app.directive('deliverySchedulingDesk',function(){
        // 将对象return出去
        return{
            restrict: 'EAC',// 指令类型  E：element A：attribute M：comment C: class
            scope :{
                asd : '='
            },
            templateUrl: './template/deliverySchedulingDesk.html',
            replace: true, //使用模板替换原始标记  指令内原本的数据将被清空
            link: function($scope, $element, attr){

            }
        }
    });
</script>
<script src="../common/layui/layui.js"></script>
</body>
</html>